<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    IS_LOCAL ? require(__DIR__ . '/../../common/config/params-local.php') : [],
    require(__DIR__ . '/params.php'),
    IS_LOCAL ? require(__DIR__ . '/params-local.php') : []
);

$modules = [];
$dirs = glob('modules'.DIRECTORY_SEPARATOR.'*');
foreach ($dirs as $d) {
	if (is_dir($d)) {
		$d = basename($d);
		$modules[$d] = ['class' => 'submodule\modules\\'.$d.'\Module'];
	}
}
return [
    'id' => 'app-submodule',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
	'defaultRoute' => 'index',
    'controllerNamespace' => 'submodule\controllers',
    'components' => [
        'user' => [
            'identityClass' => 'backend\models\Admin',
            'enableAutoLogin' => true,
			'loginUrl' => '../submodule/index.php/login',
        ],
		'view' => [
            'class' => 'submodule\base\BaseSubmoduleView',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            /*'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],*/
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'request' => [
            'cookieValidationKey' => 'YII2BACKEND',
        ],
        'session' => [
            'name' => 'YII2BACKSESSID',//可以自定义
            //'savePath' => __DIR__ . '/../tmp',//手工在backend目录下新建文件夹TMP
        ],
    ],
	'modules' => $modules,
    'params' => $params,
];
